<script setup lang="ts">
  import { computed, ref } from 'vue'
  import Password from './components/password.vue'
  import Mobile from './components/mobile.vue'

  const titleList = [
    { title: '密码登陆', subTitle: '验证码登陆' },
    { title: '验证码登陆', subTitle: '密码登陆' },
  ]
  const tabIndex = ref(0)
  const titleMeta = computed(() => {
    return titleList[tabIndex.value]
  })
  const changeTabIndex = () => {
    tabIndex.value = tabIndex.value ? 0 : 1
  }
</script>
<template>
  <view class="user-login">
    <view class="login-type">
      <view class="title">{{ titleMeta.title }}</view>
      <view class="type">
        <text @click="changeTabIndex">{{ titleMeta.subTitle }}</text>
        <uni-icons color="#3c3e42" type="forward" />
      </view>
    </view>
    <Password v-if="tabIndex === 0" />
    <Mobile v-else />
  </view>

  <!-- 社交账号登录 -->
  <view class="social-login">
    <view class="legend">
      <text class="text">其它方式登录</text>
    </view>
    <!-- #ifdef MP-WEIXIN -->
    <button open-type="getPhoneNumber" style="color: black; background-color: aqua">
      微信一键登录
    </button>
    <!-- #endif -->
    <!-- 条件编译 -->
    <!-- #ifndef MP-WEIXIN -->
    <view class="social-account">
      <view class="icon">
        <uni-icons color="#00b0fb" size="30" type="qq" />
      </view>
      <view class="icon">
        <uni-icons color="#fb6622" size="30" type="weibo" />
      </view>
      <view class="icon">
        <uni-icons color="#07C160" size="30" type="weixin" />
      </view>
    </view>
    <!-- #endif -->
  </view>
</template>

<style lang="scss">
  @import './login.scss';
</style>
